package com.zt.location.modules.base.controller;

import java.util.List;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.zt.location.common.utils.PageUtils;
import com.zt.location.common.utils.Query;
import com.zt.location.common.utils.R;
import com.zt.location.modules.base.entity.HtReadersEntity;
import com.zt.location.modules.base.entity.RfidinfoEntity;
import com.zt.location.modules.base.service.HtReadersService;




/**
 * 
 * 
 * @author admin
 * @email obj_admin@163.com
 * @date 2019-05-03 17:32:21
 */
@RestController
@RequestMapping("/base/htreaders")
public class HtReadersController {
	@Autowired
	private HtReadersService htReadersService;

	/**
	 * 列表
	 */
	@RequestMapping("/qlist")
	@RequiresPermissions("base:htreaders:qlist")
	public R qlist(@RequestParam Map<String, Object> params) {
		// 查询列表数据
		Query query = new Query(params);

		List<HtReadersEntity> htReadersList = htReadersService.queryList(query);

		return R.ok().put("htreaders", htReadersList);
	}

	/**
	 * 列表
	 */
	@RequestMapping("/list")
	@RequiresPermissions("base:htreaders:list")
	public R list(@RequestParam Map<String, Object> params) {
		// 查询列表数据
		Query query = new Query(params);

        List<HtReadersEntity> htReadersList = htReadersService.queryList(query);
        int total = htReadersService.queryTotal(query);

        PageUtils pageUtil = new PageUtils(htReadersList, total, query.getLimit(), query.getPage());

        return R.ok().put("page", pageUtil);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{readerid}")
    @RequiresPermissions("base:htreaders:info")
    public R info(@PathVariable("readerid") Integer readerid){
			HtReadersEntity htReaders = htReadersService.queryObject(readerid);

        return R.ok().put("htReaders", htReaders);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("base:htreaders:save")
    public R save(@RequestBody HtReadersEntity htReaders){
			htReadersService.save(htReaders);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("base:htreaders:update")
    public R update(@RequestBody HtReadersEntity htReaders){
			htReadersService.update(htReaders);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("base:htreaders:delete")
    public R delete(@RequestBody Integer[] readerids){
			htReadersService.deleteBatch(readerids);

        return R.ok();
    }
	
}
